{extend name="Layout/datagrid" /}
{block name="head_foot"}
<!-- lightbox2 -->
<link rel="stylesheet" href="__ui_plugins__/lightboxlib/lightbox2/css/lightbox.min.css">
{/block}
{block name="content_header"}
<h1>
    图片管理
    <small>advanced tables</small>
</h1>
<ol class="breadcrumb">
    <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
    <li><a href="#">内容</a></li>
    <li class="active">图片管理</li>
</ol>
{/block}
{block name="content"}
<div class="box">
    <div class="box-header">
        <div class="row">
            <div class="col-md-5">
                <button type="button" class="btn btn-default navbar-btn xsui-btn-add-dialog" data-url="{:url('edit')}" title="新增图片">新增</button>
                <button type="button" class="btn btn-danger navbar-btn xsui-btn-multi-delete" data-url="{:url('delete','id=varkey')}">批量删除</button>
                <button type="button" class="btn btn-info navbar-btn xsui-btn-multi-edit-dialog" data-url="{:url('category','id=varkey')}">快速编辑类别</button>
                <button type="button" class="btn btn-success navbar-btn xsui-btn-refresh">刷新</button>
            </div>
            <div class="col-md-7">
                <form class="navbar-form navbar-right">
                    <div class="form-group">
                        <select class="form-control" name="category_id" data-url="{:url('PictureCategory/getTreeJson')}" data-value="{$search.category_id}"><option>选择类别</option></select>
                    </div>
                    <div class="form-group">
                        <input type="text" name="word" class="form-control" placeholder="关键词..." title="用户名、姓名、手机号码、电子邮件" value="{$search['word']}">
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
            </div>
        </div>
    </div>
    <!-- /.box-header -->
    <div class="box-body">
        {if condition="false"}
        <div class="row">
            {foreach name="list" item="vo"}
            <div class="col-sm-3 col-md-3">
                <div class="thumbnail">
                    <img src="{$vo.file_path}" class="img-x" alt="" />
                    <div class="caption" style="clear:left;">
                        <h3>{$vo.title}</h3>
                        <p>大小：{$vo.file_size}, 扩展名：{$vo.file_ext}<br />宽度：{$vo.image_width}, 高度：{$vo.image_height}</p>
                        <p>
                            <a href="{:url('edit','id='.$vo['id'])}" class="btn btn-sm btn-info xsui-btn-edit-dialog" title="编辑图片 - {$vo.user_name}">编辑</a>
                            <a href="{:url('delete','id='.$vo['id'])}" class="btn btn-sm btn-danger xsui-btn-delete" title="删除图片 - {$vo.user_name}">删除</a>
                        </p>
                    </div>
                </div>
            </div>
            {/foreach}
        </div>
        {/if}
        <table class="xsui-datagrid table table-condensed table-bordered table-striped table-hover">
            <thead>
                <tr>
                    <th><input type="checkbox" class="xsui-btn-checking-all" /></th>
                    <th>#</th>
                    <th>标题</th>
                    <th>图片</th>
                    <th>类别</th>
                    <th>大小</th>
                    <th>扩展名</th>
                    <th>类型</th>
                    <th>排序</th>
                    <th>状态</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {foreach name="list" item="vo"}
                <tr data-key="{$vo.id}">
                    <td><input type="checkbox" value="{$vo.id}" /></td>
                    <td title="{$vo.id}"></td>
                    <td title="{$vo.id}|{$vo.title}">{$vo.title}</td>
                    <td><a href="{$vo.file_path}" data-lightbox="example-set" title="{$vo.file_path}"><img class="img-responsive img-sm" src="{$vo.file_path}" alt="" /></a></td>
                    <td>{$vo.category_title}</td>
                    <td>{$vo.file_size}</td>
                    <td>{$vo.file_ext}</td>
                    <td>{$vo.file_type}</td>
                    <td class="xsui-cell-sort"><input type="text" value="{$vo.sort}" size="3" data-value="{$vo.sort}" data-url="{:url('changeSort','id='.$vo['id'].'&sort=varsort')}" title="更改后,鼠标点击页面任意位置即可自动生效" /></td>
                    <td class="xsui-cell-status"><a href="{:url('changeStatus','id='.$vo['id'].'&status=varstatus')}" data-value="{$vo.status}" title="点击隐藏" class="text-success"><i class="fa fa-check fa-fw"></i></a></td>
                    <td>{$vo.create_time}</td>
                    <td class="xsui-action-td">
                        <div class="btn-group">
                            <a class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" href="#">
                                操作
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu pull-right" style="min-width: 60px">
                                <li><a href="{:url('edit','id='.$vo['id'])}" class="xsui-btn-edit-dialog" title="编辑图片 - {$vo.user_name}"><span class="glyphicon glyphicon-edit"></span>编辑</a></li>
                                <li><a href="{:url('delete','id='.$vo['id'])}" class="xsui-btn-delete" title="删除图片 - {$vo.user_name}"><span class="glyphicon glyphicon-remove"></span>删除</a></li>
                            </ul>
                        </div>
                    </td>
                </tr>
                {/foreach}
            </tbody>
        </table>
        {$page}
    </div>
    <!-- /.box-body -->
</div>
<!-- /.box -->
{/block}
{block name="body_foot"}
<!-- lightbox2 -->
<script src="__ui_plugins__/lightboxlib/lightbox2/js/lightbox.min.js"></script>
{/block}
{block name="script_before"}
<script>
    $('select[name="category_id"]').ajaxcombobox({first: {id: "", text: "选择类别"}});
</script>
{/block}